let total = document.querySelector('.total');
let avgSalary = document.querySelector('.avgSalary');
let avgAge = document.querySelector('.avgAge');
let proportions = document.querySelector('.proportion');
//全部学生
let datas
//判断是否有令牌
axios.get('/student/list', {
    headers: {
        Authorization: localStorage.getItem('tokens')
    }
})
    .then(res => {
        datas = res.data.data
        //显示全部学生
        total.innerHTML = datas.length
        let i = 0
        let a = 0
        let n = 0
        let m = 0
        datas.forEach(ele => {
            i += ele.salary
            a += ele.age
            ele.sex === '男'? m+=1:n+=1
        });
        avgSalary.innerHTML = (i / datas.length).toFixed(2)
        avgAge.innerHTML = parseInt(a/datas.length)
        proportions.innerHTML = `${m}/${n}`
    })




